/*     */ package com.umeng.fb.model;
/*     */ 
/*     */ import com.umeng.common.Log;
/*     */ import com.umeng.fb.c.a;
/*     */ import java.text.ParseException;
/*     */ import java.text.SimpleDateFormat;
/*     */ import java.util.Date;
/*     */ import java.util.Locale;
/*     */ import org.json.JSONException;
/*     */ import org.json.JSONObject;
/*     */ 
/*     */ public abstract class Reply
/*     */   implements Comparable<Reply>
/*     */ {
/*  17 */   private static final String a = Reply.class.getName();
/*     */   protected String b;
/*     */   protected String c;
/*     */   protected String d;
/*     */   protected String e;
/*     */   protected String f;
/*     */   protected TYPE g;
/*     */   protected Date h;
/*     */   protected STATUS i;
/*     */   private static final String j = "content";
/*     */   private static final String k = "reply_id";
/*     */   private static final String l = "appkey";
/*     */   private static final String m = "user_id";
/*     */   private static final String n = "feedback_id";
/*     */   private static final String o = "type";
/*     */   private static final String p = "datetime";
/*     */   private static final String q = "status";
/*     */ 
/*     */   Reply(String paramString1, String paramString2, String paramString3, String paramString4, TYPE paramTYPE)
/*     */   {
/*  40 */     this.b = paramString1;
/*  41 */     this.c = a.a();
/*  42 */     this.d = paramString2;
/*  43 */     this.e = paramString3;
/*  44 */     this.f = paramString4;
/*  45 */     this.g = paramTYPE;
/*  46 */     this.h = new Date();
/*  47 */     this.i = STATUS.NOT_SENT;
/*     */   }
/*     */ 
/*     */   Reply(JSONObject paramJSONObject)
/*     */     throws JSONException
/*     */   {
/*  53 */     this.b = paramJSONObject.optString("content", "");
/*  54 */     this.c = paramJSONObject.optString("reply_id", "");
/*  55 */     this.d = paramJSONObject.optString("appkey", "");
/*  56 */     this.e = paramJSONObject.optString("user_id", "");
/*  57 */     this.f = paramJSONObject.optString("feedback_id", "");
/*     */     try {
/*  59 */       this.g = TYPE.get(paramJSONObject.getString("type"));
/*     */     }
/*     */     catch (Exception localException) {
/*  62 */       throw new JSONException(localException.getMessage());
/*     */     }
/*     */     try {
/*  65 */       this.h = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(paramJSONObject
/*  66 */         .getString("datetime"));
/*     */     } catch (ParseException localParseException1) {
/*     */       try {
/*  69 */         this.h = new SimpleDateFormat().parse(paramJSONObject
/*  70 */           .getString("datetime"));
/*     */       } catch (ParseException localParseException2) {
/*  72 */         localParseException2.printStackTrace();
/*     */ 
/*  74 */         Log.b(a, 
/*  75 */           "Reply(JSONObject json): error parsing datetime from json " + 
/*  76 */           paramJSONObject.optString("datetime", "") + 
/*  77 */           ", using current Date instead.");
/*  78 */         this.h = new Date();
/*     */       }
/*     */     }
/*  81 */     String str = paramJSONObject.optString("status", STATUS.NOT_SENT.toString());
/*  82 */     this.i = STATUS.get(str);
/*     */   }
/*     */ 
/*     */   public JSONObject toJson() {
/*     */     try {
/*  87 */       JSONObject localJSONObject = new JSONObject();
/*  88 */       localJSONObject.put("content", this.b);
/*  89 */       localJSONObject.put("reply_id", this.c);
/*  90 */       localJSONObject.put("appkey", this.d);
/*  91 */       localJSONObject.put("user_id", this.e);
/*  92 */       localJSONObject.put("feedback_id", this.f);
/*  93 */       localJSONObject.put("type", this.g);
/*  94 */       localJSONObject.put("datetime", new SimpleDateFormat(
/*  95 */         "yyyy-MM-dd HH:mm:ss", Locale.US).format(this.h));
/*  96 */       localJSONObject.put("status", this.i.toString());
/*  97 */       return localJSONObject;
/*     */     } catch (JSONException localJSONException) {
/*  99 */       localJSONException.printStackTrace();
/*     */     }
/* 101 */     return null;
/*     */   }
/*     */ 
/*     */   public int compareTo(Reply paramReply)
/*     */   {
/* 107 */     return this.h.compareTo(paramReply.h);
/*     */   }
/*     */ 
/*     */   public String getContent() {
/* 111 */     return this.b;
/*     */   }
/*     */ 
/*     */   public Date getDatetime() {
/* 115 */     return this.h;
/*     */   }
/*     */ 
/*     */   public STATUS getStatus() {
/* 119 */     return this.i;
/*     */   }
/*     */ 
/*     */   public static enum STATUS
/*     */   {
/*     */     private final String a;
/*     */ 
/*     */     private STATUS(String arg3)
/*     */     {
/*     */       Object localObject;
/* 192 */       this.a = localObject;
/*     */     }
/*     */ 
/*     */     public String toString()
/*     */     {
/* 197 */       return this.a;
/*     */     }
/*     */ 
/*     */     public static STATUS get(String paramString) {
/* 201 */       if (SENDING.toString().equals(paramString))
/* 202 */         return SENDING;
/* 203 */       if (NOT_SENT.toString().equals(paramString))
/* 204 */         return NOT_SENT;
/* 205 */       if (SENT.toString().equals(paramString)) {
/* 206 */         return SENT;
/*     */       }
/* 208 */       throw new RuntimeException(paramString + "Cannot convert " + paramString + 
/* 209 */         " to enum " + STATUS.class.getName());
/*     */     }
/*     */   }
/*     */ 
/*     */   public static enum TYPE
/*     */   {
/*     */     private final String a;
/*     */ 
/*     */     private TYPE(String arg3)
/*     */     {
/*     */       Object localObject;
/* 145 */       this.a = localObject;
/*     */     }
/*     */ 
/*     */     public String toString()
/*     */     {
/* 150 */       return this.a;
/*     */     }
/*     */ 
/*     */     public static TYPE get(String paramString) {
/* 154 */       if (NEW_FEEDBACK.toString().equals(paramString))
/* 155 */         return NEW_FEEDBACK;
/* 156 */       if (DEV_REPLY.toString().equals(paramString))
/* 157 */         return DEV_REPLY;
/* 158 */       if (USER_REPLY.toString().equals(paramString)) {
/* 159 */         return USER_REPLY;
/*     */       }
/* 161 */       throw new RuntimeException(paramString + "Cannot convert " + paramString + 
/* 162 */         " to enum " + TYPE.class.getName());
/*     */     }
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\umeng_sdk.jar
 * Qualified Name:     com.umeng.fb.model.Reply
 * JD-Core Version:    0.6.2
 */